class Solution(object):
    def getSum(self, a, b):
        """
        :type a: int
        :type b: int
        :rtype: int
        """
        max1 = 2 ** 15 - 1
        max2 = 2 ** 14
        max3 = 2 ** 15 - 1
        a = a & max1
        b = b & max1
        while b != 0:
            c = ((a & b) << 1) & max1
            a = (a ^ b) & max1
            b = c
        if a & max2:
            return ~a ^ max3
        else:
            return a


data = Solution()
a = - 20
b = 10
print(data.getSum(a, b))
